From: Debian Qt/KDE Maintainers Date: Sun, 28 Apr 2024 20:48:02 +0000 (+0200) Subject: QSQL/ODBC: fix regression (trailing NUL) X-Git-Tag: archive/raspbian/5.15.2+dfsg-9+rpi1+deb11u1^2~19 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6a67cdfe8ba263e6b34f8762ec73a66137d039b7;p=qtbase-opensource-src.git QSQL/ODBC: fix regression (trailing NUL) Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9020034b3b6a3a81 Last-Update: 2023-06-30 When we fixed the callers of toSQLTCHAR() to use the result's size() instead of the input's (which differ, if sizeof(SQLTCHAR) != 2), we exposed callers to the append(0), which changes the size() of the result QVLA. Callers that don't rely on NUL-termination (all?) now saw an additional training NUL. Fix by not NUL-terminating, and changing the only user of SQL_NTS to use an explicit length. Gbp-Pq: Name sql_odbc_fix_unicode_check.diff --- diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index 7a1f2fb18..8fc320ba1 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -125,7 +125,6 @@ inline static QVarLengthArray toSQLTCHAR(const QString &input) { QVarLengthArray result; toSQLTCHARImpl(result, input); - result.append(0); // make sure it's null terminated, doesn't matter if it already is, it does if it isn't. return result; }